package switchviz.core.view;

import java.awt.BorderLayout;
import java.util.List;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;

import switchviz.graphic.signal.SignalConfigurationPanel;

public class ViewGaugeConfigurationPanel extends JPanel
{

	/**
	 * 
	 */
	private static final long serialVersionUID = -6200221363574254866L;
	private JTabbedPane _gaugetabbedpane = null;

	public ViewGaugeConfigurationPanel()
	{
		initialize();
	}
	
	private void initialize()
	{
		this.setLayout(new BorderLayout());
		_gaugetabbedpane = new JTabbedPane();
		this.add(_gaugetabbedpane, BorderLayout.CENTER);
	}
	
	
	public void setGaugeSpace(List<JPanel> gaugelist)
	{
		_gaugetabbedpane.removeAll();
		for(JPanel tab : gaugelist)
		{
			if (tab.getName().equals(SignalConfigurationPanel.SIGNALNAME))
				_gaugetabbedpane.addTab(tab.getName(), tab);
			else
				_gaugetabbedpane.addTab(tab.getName(), new JScrollPane(tab));
		}
			
		this.validate();
		this.repaint();
	}
	
	public void clearGaugeSpace()
	{
		_gaugetabbedpane.removeAll();
		this.validate();
		this.repaint();
	}
}
